package com.heima.article.controller.v2;

import com.heima.article.service.ApArticleService;
import com.heima.common.constants.ArticleContants;
import com.heima.model.article.dto.ArticleDto;
import com.heima.model.article.dto.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/api/v2/article")
public class ApArticleControllerV2 {

    @Resource
    private ApArticleService apArticleService;

    /**
     * 首页默认加载
     *
     * @param dto
     * @return
     */
    @PostMapping(path = "/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
        return apArticleService.loadV2(dto, ArticleContants.LOAD_MORE);
    }
}